package net.zeus.sample.rabbitmq.simple;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;

import net.zeus.sample.rabbitmq.utils.ConnectionUtils;

public class MqSender {
	
	public static void main(String[] args) throws Exception{
		Connection conn = ConnectionUtils.getConnection();
		
		Channel channel = conn.createChannel();
		
		channel.queueDeclare(ConnectionUtils.SIMPLE_QUEUE_NAME, false, false, false, null);
		
		String msg = "hello simple test!";
		
		channel.basicPublish("", ConnectionUtils.SIMPLE_QUEUE_NAME, null, msg.getBytes());
		
		System.out.println("send msg:" + msg);
		
		channel.close();
		ConnectionUtils.closeConnection(conn);
	}
}
